From: Florian Müllner Date: Fri, 5 Aug 2022 21:21:21 +0000 (+0200) Subject: status/network: Fix error notification for wireguard X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~461^2^2~139 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=3113e6ee2179344167f2889e762e5b772d4eed05;p=gnome-shell.git status/network: Fix error notification for wireguard The function is a handler for the `notify::state` handler, so the state and reason parameters used in the checks are always undefined. In addition, `DEACTIVATED` is not (just) a failure state. We clearly don't want to complain about a failed connection when the change happened on request of the user. Part-of: --- diff --git a/js/ui/status/network.js b/js/ui/status/network.js index c35f4bc51..c31797a4a 100644 --- a/js/ui/status/network.js +++ b/js/ui/status/network.js @@ -1477,9 +1477,13 @@ var NMWireguardItem = class extends NMConnectionItem { } } - _connectionStateChanged(ac, newstate, reason) { - if (newstate === NM.ActiveConnectionState.DEACTIVATED && - reason !== NM.ActiveConnectionStateReason.NO_SECRETS) + _connectionStateChanged() { + const state = this._activeConnection?.get_state(); + const reason = this._activeConnection?.get_state_reason(); + + if (state === NM.ActiveConnectionState.DEACTIVATED && + reason !== NM.ActiveConnectionStateReason.NO_SECRETS && + reason !== NM.ActiveConnectionStateReason.USER_DISCONNECTED) this.emit('activation-failed'); this.emit('icon-changed');